// TOWN SCRIPT
//    Town 10: Mine Tunnels
//      - connected to t9 Thessalonica Mine (se)
//      - connected to t11 Abandoned Mine (sw)
//      - connected to t12 Tangramayne Mine (nw)

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documentation. States you write
// yourself should be numbered from 10-100.

// flags:
// 10, 0 = cavern message
// 10, 1 = activity message (from abandoned mine)
// 10, 2 = chasm message ( " " " )

begintownscript;

variables;

short choice;

body;

beginstate INIT_STATE;
	turn_off_training(TRUE);
	set_crime_tolerance(1);
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
break;

beginstate 10;
	block_entry(TRUE);
	set_flag(52, 0, TRUE);
	move_to_new_town(9, 5, 4);
break;

beginstate 11;
	block_entry(TRUE);
	move_to_new_town(11, 25, 4);
break;

beginstate 12;
	block_entry(TRUE);
	move_to_new_town(12, 44, 40);
break;

beginstate 13;
	if (get_flag(10, 0) == FALSE) {
		set_flag(10, 0, TRUE);
		message_dialog("Interestingly, the mine tunnel opens up into a natural cavern.",
			"The miners have taken advantage of the wide open cavern to expand out the mining operation.");
	}
break;

beginstate 14;
	set_flag(52, 0, FALSE);
break;

beginstate 15;
	if (get_flag(50, 1) == TRUE) {
		if (get_flag(10, 1) == FALSE) {
			set_flag(10, 1, TRUE);
			message_dialog("Across the chasm you see a group a miners working in the huge cavern.",
				"One of them spots you and gives a cheery wave before getting back to work.");
		}
	}
	else {
		if (get_flag(10, 2) == FALSE) {
			set_flag(10, 2, TRUE);
			message_dialog("Across the chasm you see a huge natural cavern.",
				"There doesn't seem to be a way across to it from here though.");
		}
	}
break;

beginstate 16;
	if (get_flag(51, 6) == FALSE) {
		set_flag(51, 6, TRUE);
		message_dialog("It appears the Zanta follower did not make it far from the creatures of the cave.",
			"You search the corpse and find a small wood like object, it's a piece of the staff!");
		change_spec_item(5, 1);
	}
	else {
		message_dialog("You search the dead Zanta follower corpse and find nothing else.", "");
	}
break;
